﻿using System;

namespace AgileBoard.Web.Controllers
{
    public class Role
    {
        public const int AdministratorId = 1;
        public const int LeadDeveloperId = 2;
        public const int DeveloperId = 3;
        public const int GuestId = 4;

        // allowed roles. These must match the data in table Role
        public static Role Administrator
        {
            get { return new Role {RoleID = AdministratorId, Name = "Administrator"}; }
        }

        public static Role LeadDeveloper
        {
            get { return new Role {RoleID = LeadDeveloperId, Name = "Lead Developer"}; }
        }

        public static Role Developer
        {
            get { return new Role {RoleID = DeveloperId, Name = "Developer"}; }
        }

        public static Role Guest
        {
            get { return new Role {RoleID = GuestId, Name = "Guest"}; }
        }

        public bool IsAdministrator
        {
            get { return Name == Administrator.Name; }
        }

        public bool IsLeadDeveloper
        {
            get { return Name == LeadDeveloper.Name; }
        }

        public bool IsDeveloper
        {
            get { return Name == Developer.Name; }
        }

        public bool IsGuest
        {
            get { return Name == Guest.Name; }
        }

        /// <summary>
        /// Role id
        /// </summary>
        public int RoleID { get; set; }

        /// <summary>
        /// Project name
        /// </summary>
        public String Name { get; set; }
    }
}